package avicit.bdp.dms.tdm.utils;

import avicit.bdp.core.enums.BaseEnum;

public enum ResourceType implements BaseEnum {
  DATA_SERVICE(1, "数据服务"),
  MODEL(2, "模型"),
  FILE(3, "文档"),
  REPORT(4, "报表分析");

  ResourceType(int code, String descp) {
    this.code = code;
    this.descp = descp;
  }

  private final int code;
  private final String descp;

  public static ResourceType valueOf(int value) {
    for (ResourceType o : values()) {
      if (o.getCode() == value) {
        return o;
      }
    }
    return null;
  }

  public static String getDescByCode(Integer code) {
    if (code != null) {
      ResourceType[] values = ResourceType.values();
      for (ResourceType obj : values) {
        if (obj.getCode() == code) {
          return obj.getDescp();
        }
      }
    }

    return null;
  }

  public int getCode() {
    return code;
  }

  public String getDescp() {
    return descp;
  }

}
